using AutoMapper;
using Pay.DTO;
using Pay.Data;
using Pay.IService;

namespace Pay.Service.AutoMapper
{
    public class WXVerificationCodeMapper : IStartupDto
    {
        private IMapperConfigurationExpression _cfg;
        public WXVerificationCodeMapper(IMapperConfigurationExpression cfg)
        {
            _cfg = cfg;
        }
        public void Execute()
        {
            Create();
        }
        protected virtual void Create()
        {
            _cfg.CreateMap<WXVerificationCode, wx_verification_code_dto>()
                .ForMember(dest => dest.id, src => src.MapFrom(c => c.Id))
                .ForMember(dest => dest.verification_code, src => src.MapFrom(c => c.VerificationCode))
                .ForMember(dest => dest.user_id, src => src.MapFrom(c => c.UserId))
                .ForMember(dest => dest.wx_open_id, src => src.MapFrom(c => c.WXOpenId))
                .ForMember(dest => dest.create_time, src => src.MapFrom(c => c.CreateTime))
                .ForMember(dest => dest.merchant, src => src.MapFrom(c => c.Merchant));
        }
    }
}
